class Solution {
public:
    int rand10() {
        int idx,col,row;
        do{
            col=rand7();
            row=rand7();
            idx=col+(row-1)*7;
        }while(idx<40);
        return 1+(idx-1)%10;
    }
};
